import request from './index';

/*
    用户相关
*/

export const login = (data) => request.post('/user/login', data);
export const editUserApi = (data) => request.post('/user/editUser', data);
export const getUserApi = (data) => request.get('/user/getUser', { params: data });
export const delUserApi = (data) => request.delete('/user/delUser', { params: data });
export const registApi = (data) => request.post('/user/regist', data);


/**
 * 项目相关
 *
 */
// 获取需求列表
export const getDemand = (data) => request.get('/demand/getDemand', { params: data });
// 添加需求
export const addDemandApi = (data) => request.post('/demand/addDemand', data);
// 删除需求
export const delDemand = (data) => request.delete('/demand/delDemand', { params: data });
// 修改状态
export const editStatus = (data) => request.post('/demand/editStatus', data);

/*
    文档管理
*/
// 获取知识库
export const getStoreApi = () => request.get('/docs/getStore');
// 添加知识库
export const addStoreApi = (data) => request.post('/docs/addStore', data);
// 删除知识库
export const delStoreApi = (data) => request.delete('/docs/delStore', { params: data });
// 修改知识库
export const editStoreApi = (data) => request.post('/docs/editStore', data);

// 添加文档
export const addDocsApi = (data) => request.post('/docs/addDocs', data);
// 获取文档
export const getDocsApi = (data) => request.get('/docs/getDocs', { params: data });
// 删除文档
export const delDocsApi = (data) => request.delete('/docs/delDocs', { params: data });
// 修改文档
export const editDocsApi = (data) => request.post('/docs/editDocs', data);

/**
 *  文件
 * */
export const upload = (data) =>
  request.post('/file/upload', data, { headers: { 'Content-Type': 'multipart/form-data' } });
export const dailyUpload = (data) =>
  request.post('/file/dailyUpload', data, { headers: { 'Content-Type': 'multipart/form-data' } });

  // 角色
  // 获取角色
  export const getRoleApi = ()=> request.get('/role/getRole')
  export const deleteRoleApi = (data)=> request.delete('/role/deleteRole',{params:data})